﻿using System;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;

public static class BinaryReaderExtensions
{
    public static string ReadLine(this BinaryReader reader)
    {
        StringBuilder builder = new StringBuilder();

        char c;

        do
        {
            try
            {
                c = reader.ReadChar();
            }
            catch (EndOfStreamException)
            {
                c = '\n';
            }

            if (c != '\r' && c != '\n')
                builder.Append(c);

        } while (c != '\n');

        return builder.ToString();
    }
}